# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.13.1)

# *********************设置目标板子******************************
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})

# *********************设置项目名称*******************************
project(${BOARD})

# *********************加载main模块******************************
# 获取源文件
aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/src MAIN_SRC)

# *********************加载shell模块******************************
add_subdirectory(src/shell)
# 获取shell模块的源文件和头文件
get_property(SHELL_SRC GLOBAL PROPERTY "SHELL_SRC")
get_property(SHELL_INC GLOBAL PROPERTY "SHELL_INC" )
# 显示shell模块的源文件和头文件 
MESSAGE(STATUS "Shell Src: :${SHELL_SRC}")
MESSAGE(STATUS "Shell Inc :${SHELL_INC}")

# *********************加载driver模块******************************
add_subdirectory(src/driver)
# 获取shell模块的源文件和头文件
get_property(DRVICE_SRC GLOBAL PROPERTY "DRVICE_SRC")
get_property(DRVICE_INC GLOBAL PROPERTY "DRVICE_INC" )
# 显示shell模块的源文件和头文件 
MESSAGE(STATUS "Driver Src: :${DRVICE_SRC}")
MESSAGE(STATUS "Driver Inc :${DRVICE_INC}")


# *********************加载头文件**********************************
INCLUDE_DIRECTORIES(
    ${SHELL_INC}
    ${DRVICE_INC}
)

# ********************构建目标*************************************
target_sources(app PRIVATE
    ${MAIN_SRC}
    ${SHELL_SRC}
    ${DRVICE_SRC}
)
